package base.inner;

/**
 * \* User: Administrator
 * <p>
 * \* Date: 2020/11/18
 * <p>
 * \* Time: 16:55
 * <p>
 * \* Description:
 * \
 */
public class InnerClassDemo {

    public static void main(String[] args) {
        InnerClassDemo o = new InnerClassDemo("o");
        test();
    }

    private static void test() {
        Inner1 inner1 = new Inner1(1, "ddd");
        Inner2 inner2 = new Inner2();
    }

    private String a;

    public InnerClassDemo(String a) {
        this.a = a;
    }

    static class Inner1{
        private int a;
        private String b;

        private void test() {
            InnerClassDemo innerClassDemo = new InnerClassDemo("a");
            InnerClassDemo.test();
        }

        static {
            System.out.println("inner1 static{}");
        }

        public Inner1(int a, String b) {
            this.a = a;
            this.b = b;
            System.out.println("inner1");
        }

        public int getA() {
            return a;
        }

        public void setA(int a) {
            this.a = a;
        }

        public String getB() {
            return b;
        }

        public void setB(String b) {
            this.b = b;
        }
    }

    static class Inner2{
        private String name;
        private int age;

        public Inner2() {
            System.out.println("inner2");
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }

        static {
            System.out.println("inner2 static{}");
        }
    }
}
